#coding=utf-8
from template import tplfilter
import logs
import time

@tplfilter('date')
def date(d, formats='%Y-%m-%d %H:%M:%S'):
	t = '0'
	try:
		x = time.localtime(float(d))
		t = time.strftime(formats,x)
	except Exception, e:
		logs.seterror(str(e))
	return t